<?php

if(stristr($_SERVER['PHP_SELF'],".inc.php")) { 
	header("Location:index.php"); 
	exit; 
}

if($_GET['subop']=="add") { 
	$t = urldecode($_GET['tags']); 
	$id = intval($_GET['id']); 
	$tags = explode(",",$t); 
	foreach($tags as $k=>$v) {  
		add_tag($id,trim($v)); 
	}	
	die("1"); 
} elseif($_GET['subop']=="delete") {
	$id = intval($_GET['tagid']); 
	delete_tag($id); 
	die("1"); 
} elseif($_GET['subop']=="edit") {
	$t = urldecode($_GET['tag']); 
	$t = str_replace(",",";",$t); 
	$id = intval($_GET['tagid']);  
	update_tag($id,trim($t)); 	
	die("1"); 
} else { 
	die("0"); 
}

?>